package ooday04;
//匿名内部类演示---定时器
import java.util.Timer;
import java.util.TimerTask;
public class TimerDemo {
    public static void main(String[] args) {
        Timer timer=new Timer();
        int interval=1000;
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("该学习了！！！");
            }
        },interval,interval);




















    }
        /*
        Timer timer=new Timer();//定时器对象
        int interval=2000;
        timer.schedule(new TimerTask() {//匿名内部类的行为是只执行一次
            @Override
            public void run() {
                System.out.println("该学习了！！！！");
            }
        }, interval,3*1000*60);

    }

         */




    }

